[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Rename                   Renames a File

 Rename(var F : <file type>; NewName : <string>);                        [TP]

    Renames the file assigned to the file variable F to the name given in
    NewName. F must have previously been assigned (using the Assign
    procedure) to a disk file.

               F    Any file variable (text, data, untyped).

         NewName    Any valid MS-DOS filename. A path may be specified
                    with the filename. If a drive is specified, it must be
                    the current drive.

          Notes:    Rename should never be attempted on an open file.

                    If a path is specified in NewName, Rename actually
                    performs a move of the file to another directory if
                    the directory path is different from the current
                    directory.

                    If an error is encountered renaming a file, I/O error
                    1 ($1) occurs.

  -------------------------------- Example ---------------------------------

           Rename(F,FName+'.BAK');          { rename as a backup file }
           Rename(F,'\BIN\TEST.DAT');       { 'Moves' the file to
           \BIN\TEST.DAT }
           Rename(F,'C:FILE.DOC');          { An error will occur if current }
                                            { drive is not C: }

See Also: Assign
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson